home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
dax1.exe
/
DAP
/
DAPA
/
DAP001.C
next >
Wrap
Text File
|
1992-07-15
|
5KB
|
114 lines
// ╔════════════════════════════════════════════════════════════════════╗
// ║ ║
// ║ module: dap001.c ║
// ║ abstract: This module contains the locate server API. ║
// ║ ║
// ║ environment: NetWare 3.x v3.11 ║
// ║ Network C for NLMs SDK ║
// ║ CLib v3.11 ║
// ║ Network C for DOS v2.0 ║
// ║ NetWare C Interface DOS v1.2 ║
// ║ ║
// ║ This software is provided as is and carries no warranty ║
// ║ whatsoever. Novell disclaims and excludes any and all implied ║
// ║ warranties of merchantability, title and fitness for a particular ║
// ║ purpose. Novell does not warrant that the software will satisfy ║
// ║ your requirements or that the software is without defect or error ║
// ║ or that operation of the software will be uninterrupted. You are ║
// ║ using the software at your risk. The software is not a product ║
// ║ of Novell, Inc. or any of subsidiaries. ║
// ║ ║
// ╟────────────────────────────────────────────────────────────────────╢
// ║ maintenance history: ║
// ║ level date pi description ║
// ╟────────────────────────────────────────────────────────────────────╢
// ║ 001 01/24/92 kl initial release. ║
// ║ 002 07/14/92 kl windows port. ║
// ╚════════════════════════════════════════════════════════════════════╝
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#if defined(WINCLIENT)
#include <windows.h>
#endif
#include "cp/cpapi.h"
#include "dap/dapsys.h"
DAPDATA *DAPInitialize(char *serverName, WORD serverType)
{
long oid = -1L;
char x;
WORD type;
#if !defined(DYNAMICMEM)
static DAPDATA __dapData;
DAPDATA *DAPid = &__dapData;
#else
DAPDATA *DAPid;
if( (DAPid = (DAPDATA *)calloc(1,sizeof *DAPid)) == NULL )
return NULL;
#endif
if( ScanBinderyObject(serverName,serverType,&oid,DAPid->serverName,&type,&x,&x,&x) )
return NULL;
else if( (DAPid->CPid = CPInitialize(DAPid->serverName,serverType)) == NULL)
return NULL;
//
// Initialize the retry counts and delay variables to be used
// as the default for this session.
//
DAPid->retryCount = DEFRETRYCOUNT; // 2
DAPid->responseDelay = DEFRESPONSEDELAY; // 18
DAPid->nextSequence = DEFSEQUENCENUMBER; // 0
return DAPid;
}
void DAPDeInitialize(DAPDATA *DAPid)
{
CPDeInitialize(DAPid->CPid);
memset(DAPid,NULL,sizeof *DAPid);
#if defined(DYNAMICMEM)
free(DAPid);
#endif
}
UINT16 DAPGetNumRetries(DAPDATA *DAPid){ return DAPid->timesTried; }
UINT16 DAPGetNumSendErr(DAPDATA *DAPid){ return DAPid->sendFailed; }
#if defined(DEBUG)
//
// The following API is used to debug the client. It will save out the
// current state of both the DAP and CP Layers to a file.
//
void DAPDisplaySessionData(DAPDATA *DAPid)
{
FILE *f;
char name[20];
sprintf(name,"DIAG%03d.DAP",GetConnectionNumber());
if((f=fopen(name,"wt")) == NULL) return;
if( !DAPid ) return;
fprintf(f,"\n\tDAPid is (%p)\n",DAPid);
fprintf(f,"\t\tsessionID is %lx\n",DAPid->sessionID);
fprintf(f,"\t\tretryCount is %x\n",DAPid->retryCount);
fprintf(f,"\t\tresponseDelay is %x\n",DAPid->responseDelay);
fprintf(f,"\t\tServer name is '%s'\n",DAPid->serverName);
fprintf(f,"\t\tNext sequence number is %lx\n",DAPid->nextSequence);
fprintf(f,"\n\t\tDAPRequest\n");
fprintf(f,"\t\t\tpacketType is %x\n",DAPid->dapRequest.packetType);
fprintf(f,"\t\t\tsequence is %lx\n",DAPid->dapRequest.sequence);
fprintf(f,"\t\t\tsessionID is %lx\n",DAPid->dapRequest.sessionID);
fprintf(f,"\t\t\trequestCode is %x\n",DAPid->dapRequest.requestCode);
fprintf(f,"\n\t\tDAPReply\n");
fprintf(f,"\t\t\tpacketType is %x\n",DAPid->dapReply.packetType);
fprintf(f,"\t\t\tsequence is %lx\n",DAPid->dapReply.sequence);
fprintf(f,"\t\t\treturn code is %x\n",DAPid->dapReply.returnCode);
CPDisplaySessionData(f,DAPid->CPid);
}
#endif // defined(DEBUG)